import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/admin/account/login',
    method: 'post',
    params: data,
    headers: {
      'Content-Type': 'application/json'
    }
  })
}

export function getMenuByUser() {
  return request({
    url: '/admin/role/byMemberIdListMenu',
    method: 'get'
  })
}

export function getElementsByUser() {
  return request({
    url: '/admin/role/byMemberIdListResource',
    method: 'get'
  })
}
export function getmock() {
  return request({
    url: '/data/index',
    method: 'get'
  })
}

// export function getInfo() {
//   return request({
//     url: '/admin/manager/info',
//     method: 'get'
//   })
// }

export function getInfo() {
  // const data = {
  //   userId: localStorage.getItem('userId')
  // }
  // alert(data.userId)
  return request({
    url: `/admin/privilege/tree`,
    method: 'post',
    // params: data,
    headers: {
      'Content-Type': 'application/json'
    }
  })
}

export function getCodeImg() {
  return request({
    url: 'auth/code',
    method: 'get'
  })
}

export function logout() {
  return request({
    url: 'auth/logout',
    method: 'delete'
  })
}
export function accountInfo(data) {
  return request({
    url: '/admin/home/accountInfo',
    method: 'get'
  })
}

export function analysisPlatform(data) {
  return request({
    url: '/analysis/asset/platform',
    method: 'get'
  })
}
export function analysisUser(data) {
  return request({
    url: '/analysis/user',
    method: 'get'
  })
}
export function analysisHome(data) {
  return request({
    url: '/analysis/home',
    method: 'get'
  })
}
export function homeindex(data) {
  return request({
    url: '/admin/index/view',
    method: 'post',
    data: JSON.stringify(data),
    headers: {
      'Content-Type': 'application/json'
    }
  })
}
export function homeQuality(data) {
  return request({
    url: '/analysis/chart/deposit',
    method: 'post',
    data: JSON.stringify(data),
    headers: {
      'Content-Type': 'application/json'
    }
  })
}
export function homeIncome(data) {
  return request({
    url: '/analysis/chart/identification',
    method: 'post',
    data: JSON.stringify(data),
    headers: {
      'Content-Type': 'application/json'
    }
  })
}
export function homeRegister(data) {
  return request({
    url: '/analysis/chart/register',
    method: 'post',
    data: JSON.stringify(data),
    headers: {
      'Content-Type': 'application/json'
    }
  })
}
export function homeWithdrawal(data) {
  return request({
    url: '/analysis/chart/withdrawal',
    method: 'post',
    data: JSON.stringify(data),
    headers: {
      'Content-Type': 'application/json'
    }
  })
}
export function homeAsset(data) {
  return request({
    url: '/analysis/asset',
    method: 'post',
    data: JSON.stringify(data),
    headers: {
      'Content-Type': 'application/json'
    }
  })
}
export function homeWithdrawalFeeChart(data) {
  return request({
    url: '/analysis/withdrawalFeeChart',
    method: 'post',
    data: JSON.stringify(data),
    headers: {
      'Content-Type': 'application/json'
    }
  })
}

export function homeupdateimg(data) {
  return request({
    url: '/admin/home/updateimg',
    method: 'post',
    data: JSON.stringify(data),
    headers: {
      'Content-Type': 'application/json'
    }
  })
}
